                            # 动手试一试
# 5-1 条件测试
car = 'subaru'
print( "Is car == 'subaru'? I predict True." )
print( car == 'subaru' )
print( "Is car == 'audi'? I predict False." )
print( car == 'audi' )
# 5-2更多的条件测试
string1 = "I love China."
string2 = "This is an apple."
print( "\n" )
if string1 == string2 :
    print( "string1 == string2" )
else :
    print( "string1 != string2" )
print( "\n" )
favorite_fruit = 'APPLE'
if ( favorite_fruit.lower() == 'apple' ) :
    print( "True!" )
FruitList = [ 'banana', 'apple', 'tomato', 'pineapple', 'pear' ]
if 'banana' in FruitList :
    print( "\n'banana' is in FruitList." )
if 'peach' not in FruitList :
    print( "\n'peach' is not in FruitList." )
#if 'apple' in FruitList and 'pear' in FruitList :
if 'apple' and 'pear' in FruitList :
    print("\n'apple' and 'pear' are in FruitList.")
# 5-3 外星人颜色#1
alien_color = 'green'
if alien_color == 'green' :
    print( "You get 5 points!" )
# 5-4 外星人颜色#2
alien_color = 'yellow'
if alien_color == 'green' :
    print( "\nYou get 5 points by shooting it!" )
else :
    print("\nYou get 10 points by shooting it!")
# 5-5 外星人颜色#3
alien_color = 'red'
if alien_color == 'green' :
    print( "\nYou get 5 points by shooting it!" )
elif alien_color == 'yellow' :
    print("\nYou get 10 points by shooting it!")
elif alien_color == 'red' :
    print("\nYou get 15 points by shooting it!")
# 5-6 人生的不同阶段
age = int( input( "\n请输入您的年龄：" ) )
if age < 2 :
    print( "\n您是婴儿" )
elif age < 4 :
    print( "\n您正蹒跚学步" )
elif age < 13 :
    print( "\n您是儿童" )
elif age < 20 :
    print( "\n您是青少年" )
elif age < 65 :
    print( "\n您是成年人" )
else :
    print( "\n您是老年人" )
# 5-7 喜欢的水果
favorite_fruits = [ '香蕉', '苹果', '梨', '西瓜' ]
if '香蕉' in favorite_fruits :
    print( "\n你真的很喜欢香蕉！" )
if '苹果' in favorite_fruits :
    print("\n你真的很喜欢苹果！")
if '梨' in favorite_fruits :
    print( "\n你真的很喜欢梨！" )
if '西瓜' in favorite_fruits :
    print( "\n你真的很喜欢西瓜！" )
if '葡萄' not in favorite_fruits :
    print( "\n你不喜欢吃葡萄！" )
# 5-8 以特殊方式跟管理员打招呼 & 5-9 处理没有用户的情形
current_users = [ 'tom', 'andy', 'sam', 'admin', 'jack' ]
if current_users :
    for user in current_users :
        if user == 'admin' :
            print( "Hello admin, would you like to see a status report?\n" )
        else :
            print( "Hello " + user + ", thank you for logging in again.\n" )
else :
    print( "We need to find some users!\n" )
# 5-10 检查用户名
new_users = [ 'amy', 'tom', 'sam', 'alice', 'bob' ]
for new_user in new_users :
    if new_user.lower() in current_users :
        print( "Plears enter another name!\n" )
    else :
        print( "The name is not used.\n" )
# 5-11 序数
numbers = [ val for val in range(1, 10) ]
for number in numbers :
    if number == 1 :
        print( str(number) + 'st' )
    elif number == 2 :
        print( str(number) + 'nd' )
    elif number == 3 :
        print(str(number) + 'rd')
    else :
        print( str(number) + 'th' )